home *** CD-ROM | disk | FTP | other *** search
/ Komputer for Alle 2001 #11 / CD 11 (Black) - 2001.iso / Fruity / ROLLUPS.DXR / 00005_GENERAL HANDLERS.ls < prev    next >
Encoding:
Text File  |  1998-04-13  |  11.7 KB  |  390 lines

  1. global gFruitObj, gCompletedRollUp, gRandomPos, gNullCst, gFruitRolledOut, gRolloverSpt, gUnRolledRollUpSpt, gPackageObj, gAnimationInProgress, gFruitInPackageLoc, gGuyObj, gGuyStandingCst, gGuyWalkCst, gGuyDanceCst, gGuyWalking, gInitialColorDepth, gInteruptFlag, gPathDelim, flushActive
  2.  
  3. on EjectFruit
  4.   if gCompletedRollUp = 1 then
  5.     exit
  6.   end if
  7.   if gFruitRolledOut = 1 then
  8.     SlideClosedRollUps()
  9.   end if
  10.   RollFruit()
  11.   if count(the pPackageFruitList of gPackageObj) = 0 then
  12.     exit
  13.   end if
  14.   set gRandomPos to random(count(the pPackageFruitList of gPackageObj))
  15.   EvaluateFruit()
  16. end
  17.  
  18. on AnimatePackage
  19.   puppetSnd(1, 85)
  20.   updateStage()
  21.   repeat while soundBusy(1)
  22.   end repeat
  23.   repeat with n = 1 to 2
  24.     set the memberNum of sprite 35 to 16 + n
  25.     set vTicks to the ticks + 7
  26.     repeat while the ticks < vTicks
  27.       updateStage()
  28.     end repeat
  29.   end repeat
  30.   set the memberNum of sprite 35 to 16
  31.   updateStage()
  32. end
  33.  
  34. on EvaluateFruit
  35.   if the memberNum of sprite 30 <> gNullCst then
  36.     ReturnFruitToPackage()
  37.     AnimatePackage()
  38.     SlideFruitToStartPos()
  39.   else
  40.     AnimatePackage()
  41.     SlideFruitToStartPos()
  42.   end if
  43. end
  44.  
  45. on SlideFruitToStartPos
  46.   set the memberNum of sprite 30 to getAt(the pPackageFruitList of gPackageObj, gRandomPos)
  47.   slide(30, 41, 44, 4, 3)
  48. end
  49.  
  50. on ClickRollUp
  51.   if gCompletedRollUp = 0 then
  52.     if gFruitRolledOut = 1 then
  53.       SlideClosedRollUps()
  54.       RollFruit()
  55.     end if
  56.     set vRollover to rollOver()
  57.     if (vRollover > 9) and (vRollover < 20) then
  58.       set gRolloverSpt to vRollover
  59.       SlideClosedRollUps()
  60.       UnRollRollUp()
  61.       PlaceRollUpPieces()
  62.       repeat while soundBusy(1)
  63.       end repeat
  64.       if the memberNum of sprite 30 <> gNullCst then
  65.         set vRollupPieceList to getProp(the pFruitCarpetFullList of gFruitObj, the memberNum of sprite gRolloverSpt)
  66.         if getPos(vRollupPieceList, getAt(the pPackageFruitList of gPackageObj, gRandomPos)) > 0 then
  67.           FruitMatch()
  68.           AnimateFruitToRollup()
  69.           repeat while soundBusy(1)
  70.           end repeat
  71.           puppetSnd(1, 86)
  72.           set the memberNum of sprite 40 to gGuyStandingCst
  73.           updateStage()
  74.           repeat while soundBusy(1)
  75.           end repeat
  76.           if gCompletedRollUp = 1 then
  77.             puppetSnd(1, 89)
  78.             updateStage()
  79.             repeat while soundBusy(1)
  80.             end repeat
  81.             puppetSnd(1, 87)
  82.             updateStage()
  83.             AnimateCompletedRollup()
  84.             repeat while soundBusy(1)
  85.             end repeat
  86.             puppetSnd(1, 90)
  87.             updateStage()
  88.           else
  89.             SlideClosedRollUps()
  90.             RollFruit()
  91.           end if
  92.         else
  93.           FruitReturn()
  94.           ReturnFruitToPackage()
  95.           SlideClosedRollUps()
  96.           RollFruit()
  97.         end if
  98.       end if
  99.     end if
  100.   end if
  101. end
  102.  
  103. on SlideClosedRollUps
  104.   case gRolloverSpt of
  105.     10:
  106.       slide2(11, 12, the locV of sprite 11, 20, the locV of sprite 12, 20, 4, 3)
  107.     11:
  108.       slide2(10, 12, the locV of sprite 10, -20, the locV of sprite 12, 20, 4, 3)
  109.     12:
  110.       slide2(10, 11, the locV of sprite 10, -20, the locV of sprite 11, -20, 4, 3)
  111.   end case
  112. end
  113.  
  114. on UnRollRollUp
  115.   puppetSnd(1, 82)
  116.   updateStage()
  117.   set gFruitRolledOut to 1
  118.   set the visible of sprite gRolloverSpt to 0
  119.   updateStage()
  120.   set the memberNum of sprite gUnRolledRollUpSpt to the memberNum of sprite gRolloverSpt + 1
  121.   set the loc of sprite gUnRolledRollUpSpt to the loc of sprite gRolloverSpt
  122.   updateStage()
  123.   wait(5)
  124. end
  125.  
  126. on PlaceRollUpPieces vFruitPropList, vFruitLocPropList
  127.   set vFruitPropList to getProp(the pCarpetStatusList of gFruitObj, the memberNum of sprite gRolloverSpt)
  128.   set vFruitLocPropList to getProp(the pCarpetLocList of gFruitObj, the memberNum of sprite gRolloverSpt)
  129.   repeat with n = 1 to 4
  130.     if getAt(vFruitPropList, n) = 0 then
  131.       set the memberNum of sprite (19 + n) to gNullCst
  132.       set the loc of sprite (19 + n) to point(-1, -1)
  133.       next repeat
  134.     end if
  135.     set the memberNum of sprite (19 + n) to getAt(vFruitPropList, n)
  136.     set the loc of sprite (19 + n) to getAt(vFruitLocPropList, n)
  137.   end repeat
  138.   set the memberNum of sprite gUnRolledRollUpSpt to the memberNum of sprite gRolloverSpt + 2
  139.   updateStage()
  140. end
  141.  
  142. on FruitMatch
  143.   puppetSnd(1, 93)
  144.   updateStage()
  145.   repeat while soundBusy(1)
  146.   end repeat
  147.   set the memberNum of sprite 40 to gGuyStandingCst + 1
  148.   updateStage()
  149.   set vFruitRollupAssignment to getPos(getProp(the pFruitCarpetFullList of gFruitObj, the memberNum of sprite gRolloverSpt), getAt(the pPackageFruitList of gPackageObj, gRandomPos))
  150.   set vFruitPropList to getProp(the pCarpetStatusList of gFruitObj, the memberNum of sprite gRolloverSpt)
  151.   set vFruitLocPropList to getProp(the pCarpetLocList of gFruitObj, the memberNum of sprite gRolloverSpt)
  152.   deleteAt(vFruitPropList, vFruitRollupAssignment)
  153.   addAt(vFruitPropList, vFruitRollupAssignment, 0)
  154.   set vMatchCount to 0
  155.   repeat with n = 1 to 4
  156.     if getAt(vFruitPropList, n) = 0 then
  157.       set vMatchCount to vMatchCount + 1
  158.     end if
  159.   end repeat
  160.   if vMatchCount = 4 then
  161.     set gCompletedRollUp to 1
  162.   end if
  163. end
  164.  
  165. on AnimateFruitToRollup
  166.   set vFruitLocPropList to getProp(the pCarpetLocList of gFruitObj, the memberNum of sprite gRolloverSpt)
  167.   set vFruitRollupAssignment to getPos(getProp(the pFruitCarpetFullList of gFruitObj, the memberNum of sprite gRolloverSpt), getAt(the pPackageFruitList of gPackageObj, gRandomPos))
  168.   wait(60)
  169.   updateStage()
  170.   set vFruitH to getAt(getAt(vFruitLocPropList, vFruitRollupAssignment), 1)
  171.   set vFruitV to getAt(getAt(vFruitLocPropList, vFruitRollupAssignment), 2)
  172.   puppetSnd(1, 84)
  173.   updateStage()
  174.   AdjustSign(vFruitH, vFruitV)
  175.   puppetSound(0)
  176.   updateStage()
  177.   set the memberNum of sprite 30 to gNullCst
  178.   set the loc of sprite 30 to gFruitInPackageLoc
  179.   set the memberNum of sprite (19 + vFruitRollupAssignment) to gNullCst
  180.   set the loc of sprite (19 + vFruitRollupAssignment) to point(-1, -1)
  181.   deleteAt(the pPackageFruitList of gPackageObj, gRandomPos)
  182.   set gRandomPos to 0
  183. end
  184.  
  185. on AdjustSign vFruitH, vFruitV
  186.   case gRolloverSpt of
  187.     10:
  188.       sinSlideUnder(30, vFruitH, vFruitV, 10, 2, 3)
  189.     11:
  190.       sinSlideUnder(30, vFruitH, vFruitV, 10, 2, 30)
  191.     12:
  192.       sinSlideUnder(30, vFruitH, vFruitV, 10, 2, 60)
  193.   end case
  194. end
  195.  
  196. on RollFruit
  197.   if gFruitRolledOut = 1 then
  198.     puppetSnd(1, 83)
  199.     updateStage()
  200.     set the memberNum of sprite gUnRolledRollUpSpt to gNullCst
  201.     set the loc of sprite gUnRolledRollUpSpt to point(-1, -1)
  202.     repeat with n = 1 to 4
  203.       set the memberNum of sprite (19 + n) to gNullCst
  204.       set the loc of sprite (19 + n) to point(-1, -1)
  205.     end repeat
  206.     set the visible of sprite gRolloverSpt to 1
  207.     set the memberNum of sprite gRolloverSpt to getAt(getProp(the pFruitCarpetSptOrder of gFruitObj, gRolloverSpt), 1) + 1
  208.     updateStage()
  209.     wait(5)
  210.     set the memberNum of sprite gRolloverSpt to getAt(getProp(the pFruitCarpetSptOrder of gFruitObj, gRolloverSpt), 1)
  211.     updateStage()
  212.     set gFruitRolledOut to 0
  213.     repeat while soundBusy(1)
  214.     end repeat
  215.   end if
  216. end
  217.  
  218. on FruitReturn
  219.   puppetSnd(1, 92)
  220.   updateStage()
  221.   set the memberNum of sprite 40 to gGuyStandingCst
  222.   updateStage()
  223.   set gRandomPos to 0
  224. end
  225.  
  226. on ReturnFruitToPackage
  227.   if gCompletedRollUp = 0 then
  228.     slide(30, getAt(gFruitInPackageLoc, 1), getAt(gFruitInPackageLoc, 2), 3, 3)
  229.     set the memberNum of sprite 30 to gNullCst
  230.     set the loc of sprite 30 to gFruitInPackageLoc
  231.   end if
  232. end
  233.  
  234. on AnimateCompletedRollup
  235.   set the memberNum of sprite 40 to gGuyStandingCst
  236.   updateStage()
  237.   SlideRollsOffScreen()
  238.   slide(19, 285, 160, 8, 3)
  239.   repeat with n = 1 to 2
  240.     set the memberNum of sprite 19 to the memberNum of sprite 19 + 1
  241.     updateStage()
  242.     wait(5)
  243.   end repeat
  244.   set the memberNum of sprite 40 to gGuyWalkCst
  245.   updateStage()
  246.   set gAnimationInProgress to 1
  247. end
  248.  
  249. on SlideRollsOffScreen
  250.   case gRolloverSpt of
  251.     10:
  252.       slide2(11, 12, the locV of sprite 11, 200, the locV of sprite 12, 200, 5, 3)
  253.     11:
  254.       slide2(10, 12, the locV of sprite 10, -200, the locV of sprite 12, 200, 5, 3)
  255.     12:
  256.       slide2(10, 11, the locV of sprite 10, -200, the locV of sprite 11, -200, 5, 3)
  257.   end case
  258. end
  259.  
  260. on AnimateGuyAcrossRollup
  261.   repeat while the locH of sprite 40 < 460
  262.     repeat with n = 1 to 4
  263.       set theTime to the timer + 9
  264.       set the memberNum of sprite 40 to gGuyWalkCst + n
  265.       set the locH of sprite 40 to the locH of sprite 40 + 15
  266.       UStage(theTime)
  267.     end repeat
  268.     set the memberNum of sprite 40 to gGuyWalkCst
  269.     updateStage()
  270.   end repeat
  271.   set the memberNum of sprite 40 to gGuyDanceCst
  272.   set the loc of sprite 40 to point(460, 125)
  273.   updateStage()
  274.   repeat while soundBusy(1)
  275.   end repeat
  276.   set gAnimationInProgress to 2
  277. end
  278.  
  279. on AnimateGuyVictoryDance
  280.   puppetSnd(1, 91)
  281.   updateStage()
  282.   repeat while soundBusy(1)
  283.     repeat with n = 1 to 3
  284.       set theTime to the timer + 10
  285.       set the memberNum of sprite 40 to gGuyDanceCst + n
  286.       UStage(theTime)
  287.     end repeat
  288.   end repeat
  289.   set gAnimationInProgress to 0
  290.   EndGame()
  291. end
  292.  
  293. on updateScreen
  294.   case gAnimationInProgress of
  295.     1:
  296.       AnimateGuyAcrossRollup()
  297.     2:
  298.       AnimateGuyVictoryDance()
  299.       set the memberNum of sprite 40 to gGuyDanceCst
  300.       updateStage()
  301.   end case
  302.   UpdateAmbient()
  303. end
  304.  
  305. on EndGame
  306.   if IsShockWave() then
  307.     gotoNetPage("../ruxff.html")
  308.   else
  309.     if IsProj() then
  310.       go(1, "Frutfoot")
  311.       abort()
  312.     else
  313.       set the loc of sprite 40 to point(126, 125)
  314.       set the memberNum of sprite 40 to gGuyStandingCst
  315.       initGame()
  316.       go("Start")
  317.     end if
  318.   end if
  319. end
  320.  
  321. on slide chan, H2, V2, steps, waitTime
  322.   set deltaH to the locH of sprite chan - H2
  323.   set deltaV to the locV of sprite chan - V2
  324.   repeat with incr = 1 to steps
  325.     set theTime to the timer
  326.     set the locH of sprite chan to H2 + (deltaH * (steps - incr) / steps)
  327.     set the locV of sprite chan to V2 + (deltaV * (steps - incr) / steps)
  328.     updateStage()
  329.     repeat while the timer < (theTime + waitTime)
  330.     end repeat
  331.   end repeat
  332. end
  333.  
  334. on slide2 chan1, chan2, V1, V1Direction, V2, V2Direction, steps, waitTime
  335.   if (gFruitRolledOut = 1) and (gCompletedRollUp = 0) then
  336.     set V1Direction to V1Direction * -1
  337.     set V2Direction to V2Direction * -1
  338.   end if
  339.   set deltaV1 to the locV of sprite chan1 - (V1 + V1Direction)
  340.   set deltaV2 to the locV of sprite chan2 - (V2 + V2Direction)
  341.   repeat with incr = 1 to steps
  342.     set theTime to the timer
  343.     set the locV of sprite chan1 to V1 + V1Direction + (deltaV1 * (steps - incr) / steps)
  344.     set the locV of sprite chan2 to V2 + V2Direction + (deltaV2 * (steps - incr) / steps)
  345.     updateStage()
  346.     repeat while the timer < (theTime + waitTime)
  347.     end repeat
  348.   end repeat
  349. end
  350.  
  351. on slide3 chan1, chan2, chan3, V1, V2, V3, steps, waitTime
  352.   set deltaV1 to the locV of sprite chan1 - V1
  353.   set deltaV2 to the locV of sprite chan2 - V2
  354.   set deltaV3 to the locV of sprite chan3 - V3
  355.   repeat with incr = 1 to steps
  356.     set theTime to the timer
  357.     set the locV of sprite chan1 to V1 + (deltaV1 * (steps - incr) / steps)
  358.     set the locV of sprite chan2 to V2 + (deltaV2 * (steps - incr) / steps)
  359.     set the locV of sprite chan3 to V3 + (deltaV3 * (steps - incr) / steps)
  360.     updateStage()
  361.     repeat while the timer < (theTime + waitTime)
  362.     end repeat
  363.   end repeat
  364. end
  365.  
  366. on sinSlideUnder chan, H2, V2, steps, waitTime, a
  367.   set deltaH to the locH of sprite chan - H2
  368.   set deltaV to the locV of sprite chan - V2
  369.   repeat with incr = 1 to steps
  370.     set theTime to the timer
  371.     set percentOfPath to float(steps - incr) / float(steps)
  372.     set the locH of sprite chan to H2 + (deltaH * percentOfPath)
  373.     set the locV of sprite chan to V2 + (deltaV * percentOfPath) + (a * -1 * sin(float(incr) / float(steps) * PI))
  374.     updateStage()
  375.     repeat while the timer < (theTime + waitTime)
  376.     end repeat
  377.   end repeat
  378. end
  379.  
  380. on resetCursor
  381.   cursor(200)
  382.   cursor([2, 3])
  383. end
  384.  
  385. on UpdateAmbient
  386.   if not soundBusy(1) then
  387.     puppetSnd(1, "RollUpAmbient")
  388.   end if
  389. end
  390.